var share = {
    openContainer: function (obj) {
        var oThis = obj;
        if (oThis.hasClass("active")) {
            oThis.removeClass("active");
            $("#serverCall").hide();
        } else {
            //关闭所有设置项容器
            page.initialStatus("share");
            $("#serverCall").show();
            oThis.parents("#switch-box").find(".bar-item").removeClass("active");
            oThis.addClass("active");
        }
    },
    closeContainer: function () {
        $("#serverCall").hide();
        $("#btnShowShare").removeClass("active");
    },
    init: function () {
        $("#input_dlink").val(location.href);
        $("#qrcImg").attr("src", "http://pan.baidu.com/share/qrcode?w=145&h=145&url=" + location.href);
        /*百度分享*/
        window._bd_share_config = {
            "common": {
                "bdSnsKey": {},
                "bdText": "这是我在九尚科技的分享，为我打call吧~",
                bdUrl: location.href,
                "bdMini": "2",
                "bdMiniList": false,
                "bdPic": location.host + "/images/" + dataGuid + ".png",
                "bdStyle": "0",
                "bdSize": "32"
            },
            "share": {}
        };
        with (document)
            0[(getElementsByTagName('head')[0] || body)
					.appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='
					+ ~(-new Date() / 36e5)];


        //服务分享 
        $("#btnShowShare").on("click", function () {
            share.openContainer($(this));
        });
        //关闭服务分享
        $("#serverCall .pop-close").on("click", function () {
            share.closeContainer();
        });

        //关闭服务分享
        $(document).on("click", ".modal-backdrop", function () {
            $("#myModal .close").trigger("click");
        });
    }
}